package com.si3.modelo;

public class PaginaInfo {

	private int currentPage;
	private int pageSize;
	private int rowCount;
	private int maxIndices;
	private int pageCount;

	public PaginaInfo() {
		currentPage = 0;
		rowCount = 0;
		pageSize = 1;
		pageCount=0;
	}

	public int getCurrentPage() {
		return currentPage;
	}

	public void setCurrentPage(int currentPage) {
		if (currentPage < 0)
			this.currentPage = 0;
		else if (currentPage > getPageCount() - 1)
			this.currentPage = getPageCount() - 1;
		else
			this.currentPage = currentPage;
	}

	public int getPageSize() {
		return pageSize;
	}

	public void setPageSize(int pageSize) {
		this.pageSize = pageSize;
	}

	public int getRowCount() {
		return rowCount;
	}

	public void setRowCount(int rowCount) {
		this.rowCount = rowCount;
	}

	public int getPageCount() {
		this.pageCount=(int) Math.ceil((double) rowCount / pageSize);
		return pageCount;
	}


	public boolean isFirstPage() {
		return 0 == currentPage;
	}
	
	public boolean isLastPage() {
		return (getPageCount() - 1) == currentPage;
	}
}